package com.itany.corejava.code07_面向对象.bms;

/**
 * @author MissChen
 * @version 1.0
 * @date 2023 年11月07日 15:17
 */
public class CreditAccount extends Account{
    private double limit;//透支额度

    public double getLimit() {
        return limit;
    }

    public void setLimit(double limit) {
        this.limit = limit;
    }

    /**
     *取款方法
     * @param money
     * @return
     */
    @Override
    public boolean withdrawMoney(double money) {
        if(getBalance()+limit>=money){//0   10000   5000

            // 0      5000   -5000
            // 1000   5000   -4000
            // 1000   4000   -3000
            setBalance(getBalance()-money);
            return true;
        }
        return false;
    }
}
